﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EqRepair.Code.Data;

namespace EqRepair.Web
{
	public partial class EQ : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{

		}


		protected void DetailsView1_ItemInserted1(object sender, DetailsViewInsertedEventArgs e)
		{
			using (var db = new DataClasses2DataContext())
			{
				db.SubmitChanges();
				GridView1.DataBind();
				//Page.Response.Redirect(Page.);
			}
		}

		protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
		{
			using (var db = new DataClasses2DataContext())
			{
				db.SubmitChanges();
				GridView1.DataBind();
			}
		}

		protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
		{
			using (var db = new DataClasses2DataContext())
			{
				db.SubmitChanges();
				GridView1.DataBind();
			}
		}

		protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
		{
			//Response.Write("Дек-" +GridView1.SelectedRow.Cells[3].Text);
			
			//Response.AddHeader("id", GridView1.SelectedRow.Cells[3].Text);
			Response.Redirect("EquipmentDetail.aspx?id=" + GridView1.SelectedRow.Cells[2].Text);
		}
	}
}
